<?php

/**
 * Aviso filter form base class.
 *
 * @package    asindo
 * @subpackage filter
 * @author     Ignacio Calvo
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseAvisoFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'paciente_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Paciente'), 'add_empty' => true)),
      'franja_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Franja'), 'add_empty' => true)),
      'fecha'              => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'tipo_via'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'via'                => new sfWidgetFormFilterInput(),
      'cp'                 => new sfWidgetFormFilterInput(),
      'numero'             => new sfWidgetFormFilterInput(),
      'piso'               => new sfWidgetFormFilterInput(),
      'letra'              => new sfWidgetFormFilterInput(),
      'poblacion'          => new sfWidgetFormFilterInput(),
      'provincia'          => new sfWidgetFormFilterInput(),
      'pediatra_asindo_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Pediatra'), 'add_empty' => true)),
      'honorarios'         => new sfWidgetFormFilterInput(),
      'observaciones'      => new sfWidgetFormFilterInput(),
      'created_at'         => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'         => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'paciente_id'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Paciente'), 'column' => 'id')),
      'franja_id'          => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Franja'), 'column' => 'id')),
      'fecha'              => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'tipo_via'           => new sfValidatorPass(array('required' => false)),
      'via'                => new sfValidatorPass(array('required' => false)),
      'cp'                 => new sfValidatorPass(array('required' => false)),
      'numero'             => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'piso'               => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'letra'              => new sfValidatorPass(array('required' => false)),
      'poblacion'          => new sfValidatorPass(array('required' => false)),
      'provincia'          => new sfValidatorPass(array('required' => false)),
      'pediatra_asindo_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Pediatra'), 'column' => 'id')),
      'honorarios'         => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'observaciones'      => new sfValidatorPass(array('required' => false)),
      'created_at'         => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'         => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('aviso_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Aviso';
  }

  public function getFields()
  {
    return array(
      'id'                 => 'Number',
      'paciente_id'        => 'ForeignKey',
      'franja_id'          => 'ForeignKey',
      'fecha'              => 'Date',
      'tipo_via'           => 'Text',
      'via'                => 'Text',
      'cp'                 => 'Text',
      'numero'             => 'Number',
      'piso'               => 'Number',
      'letra'              => 'Text',
      'poblacion'          => 'Text',
      'provincia'          => 'Text',
      'pediatra_asindo_id' => 'ForeignKey',
      'honorarios'         => 'Number',
      'observaciones'      => 'Text',
      'created_at'         => 'Date',
      'updated_at'         => 'Date',
    );
  }
}
